package com.hr.classes.entity.base;

import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class TableListDTO<T> extends BasePage implements Serializable {

    static {
        tableListDto = new TableListDTO();
    }

    private static TableListDTO tableListDto;

    private List<T> list;

    public static TableListDTO setPageData(PageInfo pageInfo) {
        tableListDto.setList(pageInfo.getList());
        tableListDto.setPageNum(pageInfo.getPageNum());
        tableListDto.setPageSize(pageInfo.getPageSize());
        tableListDto.setTotal((int) pageInfo.getTotal());
        return tableListDto;
    }

}
